class VElement extends VNode{
    constructor(dom){
        super(dom);

        this._type = dom.tagName.toLowerCase();
        //获取元素
        this._attrs ={};
        Array.from(dom.attributes).forEach(attr=>{
            this._attrs[attr.name] = attr.value;
       
        })
        // console.log('dom.attributes :', dom.attributes);
        this._children = [];
        // console.log('dom.childNodes :', dom.childNodes);
        Array.from(dom.childNodes).forEach(child=>{
        switch (child.nodeType){
            case document.ELEMENT_NODE:
                this._children.push(
                    new VElement(child)
                );
                break;
            case document.TEXT_NODE:
                let node = new VText(child);
                //去掉 空文本 空格等等
                if(node._text) {
                    this._children.push(node)
                }
               
                break;
            default:
                console.log(`discarde`,child);
        }


    })
}
}